<!DOCTYPEHTML>
<html>
    <head>
        <meta charset="utf-8">
            <title>贪吃球</title>
            <style type="text/css"></style>

        </head>

        <body onkeydown="doKeyDown(event)">

            <!-- 所有元素居中 -->
            <div align="center">

                <!-- 创建画布 -->
                <canvas
                    id="Mycanvas"
                    width="600"
                    height="500"
                    style="border-top:2px solid #f00;border-bottom:2px solid green;border-left:2px solid blue;border-right:2px solid #f90;">你的浏览器不支持该功能</canvas>
                <br>

                    <script type="text/JavaScript">
                        var canva = document.getElementById("Mycanvas");
                        var context = canva.getContext("2d");

                        var img = new Image();
                        img.src = "http://eslint.cn/img/logos/zendesk.svg";

                        function Draw() {
                            var width = 600;
                            var height = 500;
                            //清空画布
                            context.clearRect(0, 0, width, height);

                            context.drawImage(img, 0, 0);
                        }

                            window.addEventListener("load", Draw, true);
                    </script>
                </body>
            </html>